<?php
namespace Controller\Admin\Adsetting;
class Edit extends \Controller\Admin\Adsetting
{
    public $data;
    public $path = array('adsetting', 'adsetting.edit');
    protected $_tpl = 'admin/adsetting/edit';

    public function get($id)
    {
        if ($id) {
            $this->result = \Model\Adsetting::find($id);
        } else {
            $this->result = array();
        }
    }

    public function post($id)
    {
        $data = $_POST;
        if ($id) {
            $adsettingModel = \Model\Adsetting::find($id);
        } else {
            $adsettingModel = new \Model\Adsetting();
        }
        $adsettingModel->set($data);
        $adsettingModel->save();
        redirect('/admin/adsetting');
    }
}